package top.tangyh.lamp.care.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import top.tangyh.basic.base.mapper.SuperMapper;
import top.tangyh.lamp.care.entity.BInpatientDiagnosis;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * Mapper 接口
 * 患者诊断信息
 * </p>
 *
 * @author zqb
 * @date 2024-07-15 10:40:53
 * @create [2024-07-15 10:40:53] [zqb] [代码生成器生成]
 */
@Repository
public interface BInpatientDiagnosisMapper extends SuperMapper<BInpatientDiagnosis> {

    default List<BInpatientDiagnosis> selectListByHospitalNumbers(List<String> hospitalNumbers, Integer diagnosisType) {
        LambdaQueryWrapper<BInpatientDiagnosis> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(BInpatientDiagnosis::getHospitalNumber, hospitalNumbers)
                .eq(BInpatientDiagnosis::getDiagnosisType,diagnosisType)
                .orderByDesc(BInpatientDiagnosis::getDiagnosisTime);
        return this.selectList(queryWrapper);
    }

    default List<BInpatientDiagnosis> selectListByDid(Set<Long> digids){
        LambdaQueryWrapper<BInpatientDiagnosis> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(BInpatientDiagnosis::getId, digids)
                .isNotNull(BInpatientDiagnosis::getDiagnosisType)
                .isNotNull(BInpatientDiagnosis::getHospitalNumber)
                .orderByDesc(BInpatientDiagnosis::getDiagnosisTime);
        return this.selectList(queryWrapper);
    }

    default List<BInpatientDiagnosis> selectListByHospitalAll(List<String> hospitalNumbers) {
        LambdaQueryWrapper<BInpatientDiagnosis> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(BInpatientDiagnosis::getHospitalNumber, hospitalNumbers)
                .isNotNull(BInpatientDiagnosis::getDiagnosisType)
                .isNotNull(BInpatientDiagnosis::getHospitalNumber)
                .orderByDesc(BInpatientDiagnosis::getDiagnosisTime);
        return this.selectList(queryWrapper);
    }

}


